extends Talent

func init():
	name = "弹性防御"
func _connect():
	sys.main.connect("onBattleStart",self,"run5")

func run5():
	for i in sys.main.btChas:
		if i.team == 1:
			i.addBuff(b_elasticDefend.new(lv))

#7 6 5 4 3
func get_info():
	return "战斗开始时赋予我方所有角色减伤，其中最后一列的角色获得50%减伤，每往前一列减少10%，减伤数值每秒降低{1}%(为0时消失)".format({1:(8-lv)})
class b_elasticDefend extends "../../azurlane_ctrl/AzurBuff.gd":
	var num = 0.5
	var tlv = 1
	func _init(tlv):
		attInit()
		id = "b_damageControl"
		dispel = 2
		buffName = "弹性防御"
		self.tlv = tlv
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
		num = (5 - masCha.cell.x) * 0.1
	func _upS():
		num -= (8-0.01*tlv)
		if num <= 0:
			isDel = true
	func _onHurt(atkInfo:AtkInfo):
		if num > 0 and atkInfo.hurtVal > 5:
			atkInfo.hurtVal *= (1-num)
